# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 911
n 911(None)[]:
	i: 56(), 138(JA), 142(), 217(), 303(), 374(), 400(), 427(), 561(), 608(JA), 646(), 729(), 823(), 885(), 910()
	o: 

nname: 910
n 910(None)[return it[field]
]:
	i: 889(t), 900()
	o: 911()

nname: 900
n 900(None)[]:
	i: 889(f)
	o: 910()

nname: 889
n 889(it[field])[]:
	i: 833(f)
	o: 900(f), 910(t)

nname: 885
n 885(None)[return audio_codec_substitution_dict.get(a_codec, a_codec)
]:
	i: 846(t), 875()
	o: 911()

nname: 875
n 875(None)[]:
	i: 846(f)
	o: 885()

nname: 846
n 846(audio_codec_substitution_dict.get(a_codec, a_codec))[a_codec = it[field]
]:
	i: 833(t)
	o: 875(f), 885(t)

nname: 833
n 833(field == 'audio_codec')[]:
	i: 733(f)
	o: 846(t), 889(f)

nname: 823
n 823(None)[del _[1]
return [](wm_pl)
]:
	i: 746(AF), 806()
	o: 911()

nname: 806
n 806(None)[for pl in wm_pl:
]:
	i: 746(for)
	o: 823()

nname: 746
n 746(None)[wm_pl = playlist_get_membership(it.wymedia_resource, 0, 10, wymedia_sorting, dict(universe=it.universe))
]:
	i: 733(t)
	o: 806(for), 823(AF)

nname: 733
n 733(field == 'playlists')[]:
	i: 660(f)
	o: 746(t), 833(f)

nname: 729
n 729(None)[return _('Unknown sound format')
]:
	i: 684(), 719()
	o: 911()

nname: 719
n 719(None)[]:
	i: 673(f)
	o: 729()

nname: 684
n 684(None)[]:
	i: 673(t)
	o: 729()

nname: 673
n 673(it['nrAudioChannels'])[]:
	i: 660(t)
	o: 684(t), 719(f)

nname: 660
n 660(field == 'nrAudioChannels')[]:
	i: 565(f)
	o: 673(t), 733(f)

nname: 646
n 646(None)[return _('Unknown number')
]:
	i: 578&588(f)
	o: 911()

nname: 608
n 608(None)[return omnicode(get_child_count(it.wymedia_resource, dict(universe=it.universe)))
]:
	i: 578&588(t)
	o: 911(JA)

nname: 578&588
n 578&588(it.wymedia_resource and it.wymedia_resource['backend'] != 'upnp')[]:
	i: 565(t)
	o: 608(t), 646(f)

nname: 565
n 565(field == 'childs')[]:
	i: 487(f)
	o: 578&588(t), 660(f)

nname: 561
n 561(None)[return _('Unknown resolution')
]:
	i: 534(), 551()
	o: 911()

nname: 551
n 551(None)[]:
	i: 500&527(f)
	o: 561()

nname: 534
n 534(None)[]:
	i: 500&527(t)
	o: 561()

nname: 500&527
n 500&527(w and h)[_[1], w = [], it['width']
h = it['height']
]:
	i: 487(t)
	o: 534(t), 551(f)

nname: 487
n 487(field == 'resolution')[]:
	i: 414(f)
	o: 500&527(t), 565(f)

nname: 427
n 427(None)[return {'0': _('Free content'), '1': _('Scrambled content')}.get(it['freeCaMode'], _('Unknown content access'))
]:
	i: 414(t)
	o: 911()

nname: 414
n 414(field == 'cas')[]:
	i: 387(f)
	o: 427(t), 487(f)

nname: 400
n 400(None)[return it.parent.name
]:
	i: 387(t)
	o: 911()

nname: 387
n 387(field == 'favorite_list')[]:
	i: 307(f)
	o: 400(t), 414(f)

nname: 374
n 374(None)[return _('Unknown URI')
]:
	i: 366(), 373()
	o: 911()

nname: 373
n 373(None)[]:
	i: 320(f)
	o: 374()

nname: 366
n 366(None)[return uri
]:
	i: 353(), 365()
	o: 374()

nname: 365
n 365(None)[]:
	i: 337(f)
	o: 366()

nname: 353
n 353(None)[return uri[16:]
]:
	i: 337(t)
	o: 366()

nname: 337
n 337(uri.startswith('file://'))[]:
	i: 320(t)
	o: 353(t), 365(f)

nname: 320
n 320(uri)[uri = it['uri']
]:
	i: 307(t)
	o: 337(t), 373(f)

nname: 307
n 307(field == 'uri')[]:
	i: 221(f)
	o: 320(t), 387(f)

nname: 303
n 303(None)[return _('Unknown date')
]:
	i: 245(), 293()
	o: 911()

nname: 293
n 293(None)[]:
	i: 234(f)
	o: 303()

nname: 245
n 245(None)[]:
	i: 234(t)
	o: 303()

nname: 234
n 234(it[field])[]:
	i: 221(t)
	o: 245(t), 293(f)

nname: 221
n 221(field in ('date', 'recordedStartDateTime'))[]:
	i: 156(f)
	o: 234(t), 307(f)

nname: 217
n 217(None)[return _('Unknown bitrate')
]:
	i: 180(), 207()
	o: 911()

nname: 207
n 207(None)[]:
	i: 169(f)
	o: 217()

nname: 180
n 180(None)[]:
	i: 169(t)
	o: 217()

nname: 169
n 169(it['bitrate'])[]:
	i: 156(t)
	o: 180(t), 207(f)

nname: 156
n 156(field == 'bitrate')[]:
	i: 60(f)
	o: 169(t), 221(f)

nname: 142
n 142(None)[return _('Unknown duration')
]:
	i: 73(f)
	o: 911()

nname: 138
n 138(None)[return seconds_to_mmss_utc(seconds)
]:
	i: 115(), 128()
	o: 911(JA)

nname: 128
n 128(None)[]:
	i: 90(f)
	o: 138()

nname: 115
n 115(None)[]:
	i: 90(t)
	o: 138()

nname: 90
n 90(seconds >= 3600)[seconds = int(duration)
]:
	i: 73(t)
	o: 115(t), 128(f)

nname: 73
n 73(duration)[duration = it['duration']
]:
	i: 60(t)
	o: 90(t), 142(f)

nname: 60
n 60(field == 'duration')[]:
	i: 0(f)
	o: 73(t), 156(f)

nname: 56
n 56(None)[return _('Unknown size')
]:
	i: 23(), 46()
	o: 911()

nname: 46
n 46(None)[]:
	i: 12(f)
	o: 56()

nname: 23
n 23(None)[]:
	i: 12(t)
	o: 56()

nname: 12
n 12(it['size'])[]:
	i: 0(t)
	o: 23(t), 46(f)

nname: 0
n 0(field == 'size')[]:
	i: 
	o: 12(t), 60(f)

nname: 911
n 911(None)[]:
	i: 12(), 90(JA), 142(), 169(), 234(), 374(), 400(), 427(), 500&527(), 578&588(JA), 673(), 823(), 846(), 889()
	o: 

nname: 889
n 889(None)[if not it[field]:
	pass
return it[field]
]:
	i: 833(f)
	o: 911()

nname: 846
n 846(None)[a_codec = it[field]
if not audio_codec_substitution_dict.get(a_codec, a_codec):
	pass
return audio_codec_substitution_dict.get(a_codec, a_codec)
]:
	i: 833(t)
	o: 911()

nname: 833
n 833(field == 'audio_codec')[]:
	i: 733(f)
	o: 846(t), 889(f)

nname: 823
n 823(None)[del _[1]
return [](wm_pl)
]:
	i: 746(AF), 806()
	o: 911()

nname: 806
n 806(None)[for pl in wm_pl:
]:
	i: 746(for)
	o: 823()

nname: 746
n 746(None)[wm_pl = playlist_get_membership(it.wymedia_resource, 0, 10, wymedia_sorting, dict(universe=it.universe))
]:
	i: 733(t)
	o: 806(for), 823(AF)

nname: 733
n 733(field == 'playlists')[]:
	i: 660(f)
	o: 746(t), 833(f)

nname: 673
n 673(None)[if it['nrAudioChannels']:
	pass
return _('Unknown sound format')
]:
	i: 660(t)
	o: 911()

nname: 660
n 660(field == 'nrAudioChannels')[]:
	i: 565(f)
	o: 673(t), 733(f)

nname: 578&588
n 578&588(None)[if it.wymedia_resource and it.wymedia_resource['backend'] != 'upnp':
	return omnicode(get_child_count(it.wymedia_resource, dict(universe=it.universe)))
else:
	return _('Unknown number')
]:
	i: 565(t)
	o: 911(JA)

nname: 565
n 565(field == 'childs')[]:
	i: 487(f)
	o: 578&588(t), 660(f)

nname: 500&527
n 500&527(None)[_[1], w = [], it['width']
h = it['height']
if w and h:
	pass
return _('Unknown resolution')
]:
	i: 487(t)
	o: 911()

nname: 487
n 487(field == 'resolution')[]:
	i: 414(f)
	o: 500&527(t), 565(f)

nname: 427
n 427(None)[return {'0': _('Free content'), '1': _('Scrambled content')}.get(it['freeCaMode'], _('Unknown content access'))
]:
	i: 414(t)
	o: 911()

nname: 414
n 414(field == 'cas')[]:
	i: 387(f)
	o: 427(t), 487(f)

nname: 400
n 400(None)[return it.parent.name
]:
	i: 387(t)
	o: 911()

nname: 387
n 387(field == 'favorite_list')[]:
	i: 307(f)
	o: 400(t), 414(f)

nname: 374
n 374(None)[return _('Unknown URI')
]:
	i: 337(), 320(f)
	o: 911()

nname: 337
n 337(None)[if uri.startswith('file://'):
	return uri[16:]
return uri
]:
	i: 320(t)
	o: 374()

nname: 320
n 320(uri)[uri = it['uri']
]:
	i: 307(t)
	o: 337(t), 374(f)

nname: 307
n 307(field == 'uri')[]:
	i: 221(f)
	o: 320(t), 387(f)

nname: 234
n 234(None)[if it[field]:
	pass
return _('Unknown date')
]:
	i: 221(t)
	o: 911()

nname: 221
n 221(field in ('date', 'recordedStartDateTime'))[]:
	i: 156(f)
	o: 234(t), 307(f)

nname: 169
n 169(None)[if it['bitrate']:
	pass
return _('Unknown bitrate')
]:
	i: 156(t)
	o: 911()

nname: 156
n 156(field == 'bitrate')[]:
	i: 60(f)
	o: 169(t), 221(f)

nname: 142
n 142(None)[return _('Unknown duration')
]:
	i: 73(f)
	o: 911()

nname: 90
n 90(None)[seconds = int(duration)
if seconds >= 3600:
	pass
return seconds_to_mmss_utc(seconds)
]:
	i: 73(t)
	o: 911(JA)

nname: 73
n 73(duration)[duration = it['duration']
]:
	i: 60(t)
	o: 90(t), 142(f)

nname: 60
n 60(field == 'duration')[]:
	i: 0(f)
	o: 73(t), 156(f)

nname: 12
n 12(None)[if it['size']:
	pass
return _('Unknown size')
]:
	i: 0(t)
	o: 911()

nname: 0
n 0(field == 'size')[]:
	i: 
	o: 12(t), 60(f)

nname: 911
n 911(None)[]:
	i: 12(), 73(JA), 169(), 234(), 320(), 400(), 427(), 500&527(), 578&588(JA), 673(), 823(), 833()
	o: 

nname: 833
n 833(None)[if field == 'audio_codec':
	a_codec = it[field]
	if not audio_codec_substitution_dict.get(a_codec, a_codec):
		pass
	return audio_codec_substitution_dict.get(a_codec, a_codec)
else:
	if not it[field]:
		pass
	return it[field]
]:
	i: 733(f)
	o: 911()

nname: 823
n 823(None)[del _[1]
return [](wm_pl)
]:
	i: 746(AF), 806()
	o: 911()

nname: 806
n 806(None)[for pl in wm_pl:
]:
	i: 746(for)
	o: 823()

nname: 746
n 746(None)[wm_pl = playlist_get_membership(it.wymedia_resource, 0, 10, wymedia_sorting, dict(universe=it.universe))
]:
	i: 733(t)
	o: 806(for), 823(AF)

nname: 733
n 733(field == 'playlists')[]:
	i: 660(f)
	o: 746(t), 833(f)

nname: 673
n 673(None)[if it['nrAudioChannels']:
	pass
return _('Unknown sound format')
]:
	i: 660(t)
	o: 911()

nname: 660
n 660(field == 'nrAudioChannels')[]:
	i: 565(f)
	o: 673(t), 733(f)

nname: 578&588
n 578&588(None)[if it.wymedia_resource and it.wymedia_resource['backend'] != 'upnp':
	return omnicode(get_child_count(it.wymedia_resource, dict(universe=it.universe)))
else:
	return _('Unknown number')
]:
	i: 565(t)
	o: 911(JA)

nname: 565
n 565(field == 'childs')[]:
	i: 487(f)
	o: 578&588(t), 660(f)

nname: 500&527
n 500&527(None)[_[1], w = [], it['width']
h = it['height']
if w and h:
	pass
return _('Unknown resolution')
]:
	i: 487(t)
	o: 911()

nname: 487
n 487(field == 'resolution')[]:
	i: 414(f)
	o: 500&527(t), 565(f)

nname: 427
n 427(None)[return {'0': _('Free content'), '1': _('Scrambled content')}.get(it['freeCaMode'], _('Unknown content access'))
]:
	i: 414(t)
	o: 911()

nname: 414
n 414(field == 'cas')[]:
	i: 387(f)
	o: 427(t), 487(f)

nname: 400
n 400(None)[return it.parent.name
]:
	i: 387(t)
	o: 911()

nname: 387
n 387(field == 'favorite_list')[]:
	i: 307(f)
	o: 400(t), 414(f)

nname: 320
n 320(None)[uri = it['uri']
if uri:
	if uri.startswith('file://'):
		return uri[16:]
	return uri
return _('Unknown URI')
]:
	i: 307(t)
	o: 911()

nname: 307
n 307(field == 'uri')[]:
	i: 221(f)
	o: 320(t), 387(f)

nname: 234
n 234(None)[if it[field]:
	pass
return _('Unknown date')
]:
	i: 221(t)
	o: 911()

nname: 221
n 221(field in ('date', 'recordedStartDateTime'))[]:
	i: 156(f)
	o: 234(t), 307(f)

nname: 169
n 169(None)[if it['bitrate']:
	pass
return _('Unknown bitrate')
]:
	i: 156(t)
	o: 911()

nname: 156
n 156(field == 'bitrate')[]:
	i: 60(f)
	o: 169(t), 221(f)

nname: 73
n 73(None)[duration = it['duration']
if duration:
	seconds = int(duration)
	if seconds >= 3600:
		pass
	return seconds_to_mmss_utc(seconds)
else:
	return _('Unknown duration')
]:
	i: 60(t)
	o: 911(JA)

nname: 60
n 60(field == 'duration')[]:
	i: 0(f)
	o: 73(t), 156(f)

nname: 12
n 12(None)[if it['size']:
	pass
return _('Unknown size')
]:
	i: 0(t)
	o: 911()

nname: 0
n 0(field == 'size')[]:
	i: 
	o: 12(t), 60(f)

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a168c>, 733: <unpyclib.structure.node instance at 0xb76a612c>, 387: <unpyclib.structure.node instance at 0xb76b070c>, 12: <unpyclib.structure.node instance at 0xb76a9f8c>, 400: <unpyclib.structure.node instance at 0xb76b078c>, 660: <unpyclib.structure.node instance at 0xb76b0e8c>, 156: <unpyclib.structure.node instance at 0xb76a1c8c>, 414: <unpyclib.structure.node instance at 0xb76b080c>, 673: <unpyclib.structure.node instance at 0xb76a9b4c>, 806: <unpyclib.structure.node instance at 0xb76a622c>, 169: <unpyclib.structure.node instance at 0xb76a906c>, 427: <unpyclib.structure.node instance at 0xb76b088c>, 307: <unpyclib.structure.node instance at 0xb76c118c>, 565: <unpyclib.structure.node instance at 0xb76b0c0c>, 823: <unpyclib.structure.node instance at 0xb76a62ac>, 60: <unpyclib.structure.node instance at 0xb76a190c>, 320: <unpyclib.structure.node instance at 0xb76a904c>, 833: <unpyclib.structure.node instance at 0xb76a908c>, 73: <unpyclib.structure.node instance at 0xb76a9cac>, '500&527': <unpyclib.structure.node instance at 0xb76a966c>, 221: <unpyclib.structure.node instance at 0xb76a1f0c>, 911: <unpyclib.structure.node instance at 0xb76a66ac>, 487: <unpyclib.structure.node instance at 0xb76b090c>, 234: <unpyclib.structure.node instance at 0xb76a9b0c>, '578&588': <unpyclib.structure.node instance at 0xb76a938c>, 746: <unpyclib.structure.node instance at 0xb76a61ac>}
nname: 0
n 0(None)[Item.__init__(self, name=get_field(item, field), type_='info')
self.item = item
self.title = title
self.field = field
self.editable = editable
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a9fac>}
nname: 126
n 126(None)[kbd.hide()
louie_send('main_list', sender=self.menu, action='reset', value=self.menu['main_list'], position=self.menu.selected_pos)
]:
	i: 90(), 117()
	o: 

nname: 90
n 90(None)[log.debug('setting ParentalRating failed ')
PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 126()

nname: 117
n 117(None)[self.name = new_value
]:
	i: 86(), 116(AE)
	o: 126()

nname: 86
n 86(None)[]:
	i: 25(), 69()
	o: 117()

nname: 69
n 69(None)[self.item[self.field] = new_value
]:
	i: 12(f)
	o: 86()

nname: 25
n 25(None)[kw = {self.field: new_value}
self.item.vfs_set_metas(_unref_link=True, **kw)
]:
	i: 12(t)
	o: 86()

nname: 12
n 12(self.item['refid'])[]:
	i: 0(try)
	o: 25(t), 69(f)

nname: 0
n 0(None)[new_value = kbd._text
]:
	i: 
	o: 12(try), 90(except)

nname: 126
n 126(None)[kbd.hide()
louie_send('main_list', sender=self.menu, action='reset', value=self.menu['main_list'], position=self.menu.selected_pos)
]:
	i: 90(), 117()
	o: 

nname: 90
n 90(None)[except:
	log.debug('setting ParentalRating failed ')
	PRINT_EXCEPTION()
]:
	i: 0()
	o: 126()

nname: 117
n 117(None)[self.name = new_value
]:
	i: 116(AE), 0()
	o: 126()

nname: 0
n 0(None)[new_value = kbd._text
try:
	if self.item['refid']:
		kw = {self.field: new_value}
		self.item.vfs_set_metas(_unref_link=True, **kw)
	else:
		self.item[self.field] = new_value
]:
	i: 
	o: 117(), 90()

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b02ac>, 116: <unpyclib.structure.node instance at 0xb76b064c>, 117: <unpyclib.structure.node instance at 0xb76b050c>, 90: <unpyclib.structure.node instance at 0xb76b06ac>, 126: <unpyclib.structure.node instance at 0xb76b052c>}
nname: 0
n 0(None)[text = None
def _InfoItem__do_update(kbd):
	new_value = kbd._text
	try:
		if self.item['refid']:
			kw = {self.field: new_value}
			self.item.vfs_set_metas(_unref_link=True, **kw)
		else:
			self.item[self.field] = new_value

kbd = KeyboardWindow(self.title, text=self.name, confirm_action=_InfoItem__do_update)
kbd.show()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a946c>}
nname: 24
n 24(None)[]:
	i: 9(), 23()
	o: 

nname: 23
n 23(None)[]:
	i: 0(f)
	o: 24()

nname: 9
n 9(None)[self._edit_value()
]:
	i: 0(t)
	o: 24()

nname: 0
n 0(self.editable)[]:
	i: 
	o: 9(t), 23(f)

nname: 0
n 0(None)[if self.editable:
	self._edit_value()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a97cc>}
nname: 0
n 0(None)[self.name = get_field(self.item, self.field)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a9c0c>}
nname: 0
n 0(None)[return hash(self.name + self.field)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a99cc>}
nname: 55
n 55(None)[return False
]:
	i: 50(), 54()
	o: 

nname: 54
n 54(None)[]:
	i: 0(f)
	o: 55()

nname: 50
n 50(None)[return self.name == other.name
]:
	i: 15(f), 34()
	o: 55()

nname: 34
n 34(None)[]:
	i: 15(t)
	o: 50()

nname: 15
n 15(self.name == other.name)[]:
	i: 0(t)
	o: 34(t), 50(f)

nname: 0
n 0(isinstance(other, InfoItem))[]:
	i: 
	o: 15(t), 54(f)

nname: 55
n 55(None)[return False
]:
	i: 15(), 0(f)
	o: 

nname: 15
n 15(None)[if self.name == other.name:
	pass
return self.name == other.name
]:
	i: 0(t)
	o: 55()

nname: 0
n 0(isinstance(other, InfoItem))[]:
	i: 
	o: 15(t), 55(f)

nname: 0
n 0(None)[if isinstance(other, InfoItem):
	if self.name == other.name:
		pass
	return self.name == other.name
return False
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a90ec>}
nname: 86
n 86(None)[]:
	i: 56(), 60()
	o: 

nname: 60
n 60(None)[return cmp(type(self), type(other))
]:
	i: 0(f)
	o: 86()

nname: 56
n 56(None)[return cmp(self.name, other.name)
]:
	i: 15(f), 37()
	o: 86()

nname: 37
n 37(None)[]:
	i: 15(t)
	o: 56()

nname: 15
n 15(cmp(self.name, other.name))[]:
	i: 0(t)
	o: 37(t), 56(f)

nname: 0
n 0(isinstance(other, InfoItem))[]:
	i: 
	o: 15(t), 60(f)

nname: 86
n 86(None)[]:
	i: 15(), 60()
	o: 

nname: 60
n 60(None)[return cmp(type(self), type(other))
]:
	i: 0(f)
	o: 86()

nname: 15
n 15(None)[if cmp(self.name, other.name):
	pass
return cmp(self.name, other.name)
]:
	i: 0(t)
	o: 86()

nname: 0
n 0(isinstance(other, InfoItem))[]:
	i: 
	o: 15(t), 60(f)

nname: 0
n 0(None)[if isinstance(other, InfoItem):
	if cmp(self.name, other.name):
		pass
	return cmp(self.name, other.name)
else:
	return cmp(type(self), type(other))
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a964c>}
nname: 6
n 6(None)[__doc__ = ' Item used to store a metadata (title: value) '
def __init__(self, item, title, field, editable=False):
	Item.__init__(self, name=get_field(item, field), type_='info')
	self.item = item
	self.title = title
	self.field = field
	self.editable = editable

def _edit_value(self):
	text = None
	def _InfoItem__do_update(kbd):
		new_value = kbd._text
		try:
			if self.item['refid']:
				kw = {self.field: new_value}
				self.item.vfs_set_metas(_unref_link=True, **kw)
			else:
				self.item[self.field] = new_value

	kbd = KeyboardWindow(self.title, text=self.name, confirm_action=_InfoItem__do_update)
	kbd.show()
	return None

def execute(self):
	if self.editable:
		self._edit_value()

def reload(self):
	self.name = get_field(self.item, self.field)

def __hash__(self):
	return hash(self.name + self.field)

def __eq__(self, other):
	if isinstance(other, InfoItem):
		if self.name == other.name:
			pass
		return self.name == other.name
	return False

def __cmp__(self, other):
	if isinstance(other, InfoItem):
		if cmp(self.name, other.name):
			pass
		return cmp(self.name, other.name)
	else:
		return cmp(type(self), type(other))

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7699eec>}
nname: 0
n 0(None)[self.item = item
self.actions_dict = {'on': {'handler': self.check_active, 'caption': _('Active'), 'checked': self.item.active, 'args': ('on',), 'kwargs': {}}, 'off': {'handler': self.check_active, 'caption': _('Inactive'), 'checked': not self.item.active, 'args': ('off',), 'kwargs': {}}}
ActionContainer.__init__(self, name, type_='info', menu=menu, **kw)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a906c>}
nname: 0
n 0(None)[self.item.active = not self.item.active
self._update_checked(key)
self.menu._set_options_list(keep_selection=True)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7699c0c>}
nname: 6
n 6(None)[__doc__ = 'Item used to toggle the active/inactive status\n    of a scheduled record.\n    '
radio = True
def __init__(self, item, menu, name, **kw):
	self.item = item
	self.actions_dict = {'on': {'handler': self.check_active, 'caption': _('Active'), 'checked': self.item.active, 'args': ('on',), 'kwargs': {}}, 'off': {'handler': self.check_active, 'caption': _('Inactive'), 'checked': not self.item.active, 'args': ('off',), 'kwargs': {}}}
	ActionContainer.__init__(self, name, type_='info', menu=menu, **kw)

def check_active(self, key):
	self.item.active = not self.item.active
	self._update_checked(key)
	self.menu._set_options_list(keep_selection=True)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7699a0c>}
nname: 222
n 222(None)[name = _('Unhide')
ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
self.radio = True
]:
	i: 199(), 212()
	o: 

nname: 212
n 212(None)[]:
	i: 0(f)
	o: 222()

nname: 199
n 199(None)[]:
	i: 0(t)
	o: 222()

nname: 0
n 0(item['hidden'])[self.item = item
self.actions_dict = {'hide': {'handler': self.hide, 'caption': _('Hide'), 'checked': bool(self.item['hidden']), 'args': ('hide',), 'kwargs': {}}, 'unhide': {'handler': self.hide, 'caption': _('Unhide'), 'checked': not bool(self.item['hidden']), 'args': ('unhide',), 'kwargs': {}}}
self.title = name
self.field = 'protection'
]:
	i: 
	o: 199(t), 212(f)

nname: 0
n 0(None)[self.item = item
self.actions_dict = {'hide': {'handler': self.hide, 'caption': _('Hide'), 'checked': bool(self.item['hidden']), 'args': ('hide',), 'kwargs': {}}, 'unhide': {'handler': self.hide, 'caption': _('Unhide'), 'checked': not bool(self.item['hidden']), 'args': ('unhide',), 'kwargs': {}}}
self.title = name
self.field = 'protection'
if item['hidden']:
	pass
name = _('Unhide')
ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
self.radio = True
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a958c>}
nname: 93
n 93(None)[self.menu._set_options_list(keep_selection=True)
]:
	i: 43(), 60(), 92(AE)
	o: 

nname: 60
n 60(None)[log.debug('Setting %s[hide] failed ', self.item)
PRINT_EXCEPTION()
]:
	i: 37(except)
	o: 93()

nname: 43
n 43(None)[self.item['hidden'] = new_hide
]:
	i: 37(try)
	o: 93()

nname: 37
n 37(None)[new_hide = '1'
]:
	i: 26(), 33()
	o: 43(try), 60(except)

nname: 33
n 33(None)[]:
	i: 0(f)
	o: 37()

nname: 26
n 26(None)[]:
	i: 0(t)
	o: 37()

nname: 0
n 0(self.item['hidden'])[self._update_checked(key)
]:
	i: 
	o: 26(t), 33(f)

nname: 93
n 93(None)[self.menu._set_options_list(keep_selection=True)
]:
	i: 43()
	o: 

nname: 43
n 43(None)[try:
	self.item['hidden'] = new_hide
except:
	log.debug('Setting %s[hide] failed ', self.item)
	PRINT_EXCEPTION()
]:
	i: 0(try)
	o: 93()

nname: 0
n 0(None)[self._update_checked(key)
if self.item['hidden']:
	pass
new_hide = '1'
]:
	i: 
	o: 43(try)

nname: 93
n 93(None)[self.menu._set_options_list(keep_selection=True)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[self._update_checked(key)
if self.item['hidden']:
	pass
new_hide = '1'
try:
	self.item['hidden'] = new_hide
except:
	log.debug('Setting %s[hide] failed ', self.item)
	PRINT_EXCEPTION()
]:
	i: 
	o: 93()

nname: 0
n 0(None)[self._update_checked(key)
if self.item['hidden']:
	pass
new_hide = '1'
try:
	self.item['hidden'] = new_hide
except:
	log.debug('Setting %s[hide] failed ', self.item)
	PRINT_EXCEPTION()
self.menu._set_options_list(keep_selection=True)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a97cc>}
nname: 6
n 6(None)[__doc__ = ' Handle protections on Item (only hide for now) '
def __init__(self, item, menu, name, **kw):
	self.item = item
	self.actions_dict = {'hide': {'handler': self.hide, 'caption': _('Hide'), 'checked': bool(self.item['hidden']), 'args': ('hide',), 'kwargs': {}}, 'unhide': {'handler': self.hide, 'caption': _('Unhide'), 'checked': not bool(self.item['hidden']), 'args': ('unhide',), 'kwargs': {}}}
	self.title = name
	self.field = 'protection'
	if item['hidden']:
		pass
	name = _('Unhide')
	ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
	self.radio = True

def hide(self, key):
	self._update_checked(key)
	if self.item['hidden']:
		pass
	new_hide = '1'
	try:
		self.item['hidden'] = new_hide
	except:
		log.debug('Setting %s[hide] failed ', self.item)
		PRINT_EXCEPTION()
	self.menu._set_options_list(keep_selection=True)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb7699f4c>}
nname: 550
n 550(None)[name = self.actions_dict[rate]['caption']
ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
self.radio = True
self._update_checked(rate)
]:
	i: 539(), 549()
	o: 

nname: 549
n 549(None)[]:
	i: 26(f)
	o: 550()

nname: 539
n 539(None)[rate = '0'
]:
	i: 26(t)
	o: 550()

nname: 26
n 26(rate not in self.actions_dict)[rate = self.item['maturity_rating']
self.title = name
self.field = 'parental_rating'
self.actions_dict = {'0': {'handler': self.rate, 'caption': _('No rating'), 'checked': rate == 0, 'args': ('0',), 'kwargs': {}, 'pos': 0}, '10': {'handler': self.rate, 'caption': _('-10 years'), 'checked': rate == 10, 'args': ('10',), 'kwargs': {}, 'pos': 1}, '12': {'handler': self.rate, 'caption': _('10 - 12 years'), 'checked': rate == 12, 'args': ('12',), 'kwargs': {}, 'pos': 2}, '16': {'handler': self.rate, 'caption': _('12 - 16 years'), 'checked': rate == 16, 'args': ('16',), 'kwargs': {}, 'pos': 3}, '18': {'handler': self.rate, 'caption': _('16 - 18 years'), 'checked': rate == 18, 'args': ('18',), 'kwargs': {}, 'pos': 4}, '99': {'handler': self.rate, 'caption': _('Hidden'), 'checked': rate == 99, 'args': ('99',), 'kwargs': {}, 'pos': 5}}
]:
	i: 0(t), 22()
	o: 539(t), 549(f)

nname: 22
n 22(None)[]:
	i: 0(f)
	o: 26()

nname: 0
n 0(self.item['maturity_rating'])[self.item = item
]:
	i: 
	o: 22(f), 26(t)

nname: 550
n 550(None)[name = self.actions_dict[rate]['caption']
ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
self.radio = True
self._update_checked(rate)
]:
	i: 0()
	o: 

nname: 0
n 0(None)[self.item = item
if not self.item['maturity_rating']:
	pass
rate = self.item['maturity_rating']
self.title = name
self.field = 'parental_rating'
self.actions_dict = {'0': {'handler': self.rate, 'caption': _('No rating'), 'checked': rate == 0, 'args': ('0',), 'kwargs': {}, 'pos': 0}, '10': {'handler': self.rate, 'caption': _('-10 years'), 'checked': rate == 10, 'args': ('10',), 'kwargs': {}, 'pos': 1}, '12': {'handler': self.rate, 'caption': _('10 - 12 years'), 'checked': rate == 12, 'args': ('12',), 'kwargs': {}, 'pos': 2}, '16': {'handler': self.rate, 'caption': _('12 - 16 years'), 'checked': rate == 16, 'args': ('16',), 'kwargs': {}, 'pos': 3}, '18': {'handler': self.rate, 'caption': _('16 - 18 years'), 'checked': rate == 18, 'args': ('18',), 'kwargs': {}, 'pos': 4}, '99': {'handler': self.rate, 'caption': _('Hidden'), 'checked': rate == 99, 'args': ('99',), 'kwargs': {}, 'pos': 5}}
if rate not in self.actions_dict:
	rate = '0'
]:
	i: 
	o: 550()

nname: 0
n 0(None)[self.item = item
if not self.item['maturity_rating']:
	pass
rate = self.item['maturity_rating']
self.title = name
self.field = 'parental_rating'
self.actions_dict = {'0': {'handler': self.rate, 'caption': _('No rating'), 'checked': rate == 0, 'args': ('0',), 'kwargs': {}, 'pos': 0}, '10': {'handler': self.rate, 'caption': _('-10 years'), 'checked': rate == 10, 'args': ('10',), 'kwargs': {}, 'pos': 1}, '12': {'handler': self.rate, 'caption': _('10 - 12 years'), 'checked': rate == 12, 'args': ('12',), 'kwargs': {}, 'pos': 2}, '16': {'handler': self.rate, 'caption': _('12 - 16 years'), 'checked': rate == 16, 'args': ('16',), 'kwargs': {}, 'pos': 3}, '18': {'handler': self.rate, 'caption': _('16 - 18 years'), 'checked': rate == 18, 'args': ('18',), 'kwargs': {}, 'pos': 4}, '99': {'handler': self.rate, 'caption': _('Hidden'), 'checked': rate == 99, 'args': ('99',), 'kwargs': {}, 'pos': 5}}
if rate not in self.actions_dict:
	rate = '0'
name = self.actions_dict[rate]['caption']
ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
self.radio = True
self._update_checked(rate)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76a9e0c>}
nname: 257
n 257(None)[]:
	i: 220(), 224(), 256(AE)
	o: 

nname: 224
n 224(None)[log.debug('setting %s[maturity_rating] failed ', self.item)
PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 257()

nname: 220
n 220(None)[]:
	i: 73(), 177(), 206()
	o: 257()

nname: 206
n 206(None)[self.item['maturity_rating'] = age
]:
	i: 163(f)
	o: 220()

nname: 177
n 177(None)[self.item.vfs_set_metas(_unref_link=True, maturity_rating=age)
]:
	i: 163(t)
	o: 220()

nname: 163
n 163(self.item['refid'])[]:
	i: 55(f)
	o: 177(t), 206(f)

nname: 73
n 73(None)[w = LoadingWindow()
w.show()
ml = Markerlist(self.item.universe, 'rate')
ml.add_item(self.item)
ml['maturity_rating'] = age
w.hide()
ml.clear()
]:
	i: 55(t)
	o: 220()

nname: 55
n 55(isinstance(self.item, DirItem))[]:
	i: 0(try)
	o: 73(t), 163(f)

nname: 0
n 0(None)[self._update_checked(age)
self.name = self.actions_dict[age]['caption']
self.menu._set_options_list(keep_selection=True)
]:
	i: 
	o: 55(try), 224(except)

nname: 257
n 257(None)[]:
	i: 224(), 0()
	o: 

nname: 224
n 224(None)[except:
	log.debug('setting %s[maturity_rating] failed ', self.item)
	PRINT_EXCEPTION()
]:
	i: 0()
	o: 257()

nname: 257
n 257(None)[]:
	i: 224(), 0()
	o: 

nname: 0
n 0(None)[self._update_checked(age)
self.name = self.actions_dict[age]['caption']
self.menu._set_options_list(keep_selection=True)
try:
	if isinstance(self.item, DirItem):
		w = LoadingWindow()
		w.show()
		ml = Markerlist(self.item.universe, 'rate')
		ml.add_item(self.item)
		ml['maturity_rating'] = age
		w.hide()
		ml.clear()
	else:
		if self.item['refid']:
			self.item.vfs_set_metas(_unref_link=True, maturity_rating=age)
		else:
			self.item['maturity_rating'] = age
]:
	i: 
	o: 257(), 224()

self.nodes: {0: <unpyclib.structure.node instance at 0xb76b0d0c>, 224: <unpyclib.structure.node instance at 0xb76a988c>, 257: <unpyclib.structure.node instance at 0xb76a9c2c>}
nname: 6
n 6(None)[__doc__ = ' Handle parental rating on Item '
def __init__(self, item, menu, name, **kw):
	self.item = item
	if not self.item['maturity_rating']:
		pass
	rate = self.item['maturity_rating']
	self.title = name
	self.field = 'parental_rating'
	self.actions_dict = {'0': {'handler': self.rate, 'caption': _('No rating'), 'checked': rate == 0, 'args': ('0',), 'kwargs': {}, 'pos': 0}, '10': {'handler': self.rate, 'caption': _('-10 years'), 'checked': rate == 10, 'args': ('10',), 'kwargs': {}, 'pos': 1}, '12': {'handler': self.rate, 'caption': _('10 - 12 years'), 'checked': rate == 12, 'args': ('12',), 'kwargs': {}, 'pos': 2}, '16': {'handler': self.rate, 'caption': _('12 - 16 years'), 'checked': rate == 16, 'args': ('16',), 'kwargs': {}, 'pos': 3}, '18': {'handler': self.rate, 'caption': _('16 - 18 years'), 'checked': rate == 18, 'args': ('18',), 'kwargs': {}, 'pos': 4}, '99': {'handler': self.rate, 'caption': _('Hidden'), 'checked': rate == 99, 'args': ('99',), 'kwargs': {}, 'pos': 5}}
	if rate not in self.actions_dict:
		rate = '0'
	name = self.actions_dict[rate]['caption']
	ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
	self.radio = True
	self._update_checked(rate)

def rate(self, age):
	self._update_checked(age)
	self.name = self.actions_dict[age]['caption']
	self.menu._set_options_list(keep_selection=True)
	try:
		if isinstance(self.item, DirItem):
			w = LoadingWindow()
			w.show()
			ml = Markerlist(self.item.universe, 'rate')
			ml.add_item(self.item)
			ml['maturity_rating'] = age
			w.hide()
			ml.clear()
		else:
			if self.item['refid']:
				self.item.vfs_set_metas(_unref_link=True, maturity_rating=age)
			else:
				self.item['maturity_rating'] = age

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb769998c>}
nname: 0
n 0(None)[from __future__ import absolute_import
from time import localtime, strftime
from wymedia.wmplus import get_child_count, playlist_get_membership
from peewee.formatters import seconds_to_hhmmss_utc, seconds_to_mmss_utc, bytes_to_human, bits_to_human
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.messages import send as louie_send
from .containers import ActionContainer
from .core import Item
from pygui.markerlist import Markerlist
from pygui.window import KeyboardWindow, LoadingWindow
from pygui.item.mediaitem.core import DirItem, wymedia_sorting
from pygui.facilities.codemapping import soundconfig_dict, audio_codec_substitution_dict
from pygui.facilities.l10n import get_date_format, get_time_format, omnicode
log = GET_LOGGER(__name__)
def get_field(it, field):
	pass

class InfoItem(Item):
	__doc__ = ' Item used to store a metadata (title: value) '
	def __init__(self, item, title, field, editable=False):
		Item.__init__(self, name=get_field(item, field), type_='info')
		self.item = item
		self.title = title
		self.field = field
		self.editable = editable

	def _edit_value(self):
		text = None
		def _InfoItem__do_update(kbd):
			new_value = kbd._text
			try:
				if self.item['refid']:
					kw = {self.field: new_value}
					self.item.vfs_set_metas(_unref_link=True, **kw)
				else:
					self.item[self.field] = new_value

		kbd = KeyboardWindow(self.title, text=self.name, confirm_action=_InfoItem__do_update)
		kbd.show()
		return None

	def execute(self):
		if self.editable:
			self._edit_value()

	def reload(self):
		self.name = get_field(self.item, self.field)

	def __hash__(self):
		return hash(self.name + self.field)

	def __eq__(self, other):
		if isinstance(other, InfoItem):
			if self.name == other.name:
				pass
			return self.name == other.name
		return False

	def __cmp__(self, other):
		if isinstance(other, InfoItem):
			if cmp(self.name, other.name):
				pass
			return cmp(self.name, other.name)
		else:
			return cmp(type(self), type(other))



class RecordActivationItem(ActionContainer):
	__doc__ = 'Item used to toggle the active/inactive status\n    of a scheduled record.\n    '
	radio = True
	def __init__(self, item, menu, name, **kw):
		self.item = item
		self.actions_dict = {'on': {'handler': self.check_active, 'caption': _('Active'), 'checked': self.item.active, 'args': ('on',), 'kwargs': {}}, 'off': {'handler': self.check_active, 'caption': _('Inactive'), 'checked': not self.item.active, 'args': ('off',), 'kwargs': {}}}
		ActionContainer.__init__(self, name, type_='info', menu=menu, **kw)

	def check_active(self, key):
		self.item.active = not self.item.active
		self._update_checked(key)
		self.menu._set_options_list(keep_selection=True)



class ProtectionsActionItem(ActionContainer):
	__doc__ = ' Handle protections on Item (only hide for now) '
	def __init__(self, item, menu, name, **kw):
		self.item = item
		self.actions_dict = {'hide': {'handler': self.hide, 'caption': _('Hide'), 'checked': bool(self.item['hidden']), 'args': ('hide',), 'kwargs': {}}, 'unhide': {'handler': self.hide, 'caption': _('Unhide'), 'checked': not bool(self.item['hidden']), 'args': ('unhide',), 'kwargs': {}}}
		self.title = name
		self.field = 'protection'
		if item['hidden']:
			pass
		name = _('Unhide')
		ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
		self.radio = True

	def hide(self, key):
		self._update_checked(key)
		if self.item['hidden']:
			pass
		new_hide = '1'
		try:
			self.item['hidden'] = new_hide
		except:
			log.debug('Setting %s[hide] failed ', self.item)
			PRINT_EXCEPTION()
		self.menu._set_options_list(keep_selection=True)



class ParentalRatingActionItem(ActionContainer):
	__doc__ = ' Handle parental rating on Item '
	def __init__(self, item, menu, name, **kw):
		self.item = item
		if not self.item['maturity_rating']:
			pass
		rate = self.item['maturity_rating']
		self.title = name
		self.field = 'parental_rating'
		self.actions_dict = {'0': {'handler': self.rate, 'caption': _('No rating'), 'checked': rate == 0, 'args': ('0',), 'kwargs': {}, 'pos': 0}, '10': {'handler': self.rate, 'caption': _('-10 years'), 'checked': rate == 10, 'args': ('10',), 'kwargs': {}, 'pos': 1}, '12': {'handler': self.rate, 'caption': _('10 - 12 years'), 'checked': rate == 12, 'args': ('12',), 'kwargs': {}, 'pos': 2}, '16': {'handler': self.rate, 'caption': _('12 - 16 years'), 'checked': rate == 16, 'args': ('16',), 'kwargs': {}, 'pos': 3}, '18': {'handler': self.rate, 'caption': _('16 - 18 years'), 'checked': rate == 18, 'args': ('18',), 'kwargs': {}, 'pos': 4}, '99': {'handler': self.rate, 'caption': _('Hidden'), 'checked': rate == 99, 'args': ('99',), 'kwargs': {}, 'pos': 5}}
		if rate not in self.actions_dict:
			rate = '0'
		name = self.actions_dict[rate]['caption']
		ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
		self.radio = True
		self._update_checked(rate)

	def rate(self, age):
		self._update_checked(age)
		self.name = self.actions_dict[age]['caption']
		self.menu._set_options_list(keep_selection=True)
		try:
			if isinstance(self.item, DirItem):
				w = LoadingWindow()
				w.show()
				ml = Markerlist(self.item.universe, 'rate')
				ml.add_item(self.item)
				ml['maturity_rating'] = age
				w.hide()
				ml.clear()
			else:
				if self.item['refid']:
					self.item.vfs_set_metas(_unref_link=True, maturity_rating=age)
				else:
					self.item['maturity_rating'] = age



]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb770c28c>}
from __future__ import absolute_import
from time import localtime, strftime
from wymedia.wmplus import get_child_count, playlist_get_membership
from peewee.formatters import seconds_to_hhmmss_utc, seconds_to_mmss_utc, bytes_to_human, bits_to_human
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.messages import send as louie_send
from .containers import ActionContainer
from .core import Item
from pygui.markerlist import Markerlist
from pygui.window import KeyboardWindow, LoadingWindow
from pygui.item.mediaitem.core import DirItem, wymedia_sorting
from pygui.facilities.codemapping import soundconfig_dict, audio_codec_substitution_dict
from pygui.facilities.l10n import get_date_format, get_time_format, omnicode
log = GET_LOGGER(__name__)
def get_field(it, field):
	pass

class InfoItem(Item):
	__doc__ = ' Item used to store a metadata (title: value) '
	def __init__(self, item, title, field, editable=False):
		Item.__init__(self, name=get_field(item, field), type_='info')
		self.item = item
		self.title = title
		self.field = field
		self.editable = editable

	def _edit_value(self):
		text = None
		def _InfoItem__do_update(kbd):
			new_value = kbd._text
			try:
				if self.item['refid']:
					kw = {self.field: new_value}
					self.item.vfs_set_metas(_unref_link=True, **kw)
				else:
					self.item[self.field] = new_value

		kbd = KeyboardWindow(self.title, text=self.name, confirm_action=_InfoItem__do_update)
		kbd.show()
		return None

	def execute(self):
		if self.editable:
			self._edit_value()

	def reload(self):
		self.name = get_field(self.item, self.field)

	def __hash__(self):
		return hash(self.name + self.field)

	def __eq__(self, other):
		if isinstance(other, InfoItem):
			if self.name == other.name:
				pass
			return self.name == other.name
		return False

	def __cmp__(self, other):
		if isinstance(other, InfoItem):
			if cmp(self.name, other.name):
				pass
			return cmp(self.name, other.name)
		else:
			return cmp(type(self), type(other))



class RecordActivationItem(ActionContainer):
	__doc__ = 'Item used to toggle the active/inactive status\n    of a scheduled record.\n    '
	radio = True
	def __init__(self, item, menu, name, **kw):
		self.item = item
		self.actions_dict = {'on': {'handler': self.check_active, 'caption': _('Active'), 'checked': self.item.active, 'args': ('on',), 'kwargs': {}}, 'off': {'handler': self.check_active, 'caption': _('Inactive'), 'checked': not self.item.active, 'args': ('off',), 'kwargs': {}}}
		ActionContainer.__init__(self, name, type_='info', menu=menu, **kw)

	def check_active(self, key):
		self.item.active = not self.item.active
		self._update_checked(key)
		self.menu._set_options_list(keep_selection=True)



class ProtectionsActionItem(ActionContainer):
	__doc__ = ' Handle protections on Item (only hide for now) '
	def __init__(self, item, menu, name, **kw):
		self.item = item
		self.actions_dict = {'hide': {'handler': self.hide, 'caption': _('Hide'), 'checked': bool(self.item['hidden']), 'args': ('hide',), 'kwargs': {}}, 'unhide': {'handler': self.hide, 'caption': _('Unhide'), 'checked': not bool(self.item['hidden']), 'args': ('unhide',), 'kwargs': {}}}
		self.title = name
		self.field = 'protection'
		if item['hidden']:
			pass
		name = _('Unhide')
		ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
		self.radio = True

	def hide(self, key):
		self._update_checked(key)
		if self.item['hidden']:
			pass
		new_hide = '1'
		try:
			self.item['hidden'] = new_hide
		except:
			log.debug('Setting %s[hide] failed ', self.item)
			PRINT_EXCEPTION()
		self.menu._set_options_list(keep_selection=True)



class ParentalRatingActionItem(ActionContainer):
	__doc__ = ' Handle parental rating on Item '
	def __init__(self, item, menu, name, **kw):
		self.item = item
		if not self.item['maturity_rating']:
			pass
		rate = self.item['maturity_rating']
		self.title = name
		self.field = 'parental_rating'
		self.actions_dict = {'0': {'handler': self.rate, 'caption': _('No rating'), 'checked': rate == 0, 'args': ('0',), 'kwargs': {}, 'pos': 0}, '10': {'handler': self.rate, 'caption': _('-10 years'), 'checked': rate == 10, 'args': ('10',), 'kwargs': {}, 'pos': 1}, '12': {'handler': self.rate, 'caption': _('10 - 12 years'), 'checked': rate == 12, 'args': ('12',), 'kwargs': {}, 'pos': 2}, '16': {'handler': self.rate, 'caption': _('12 - 16 years'), 'checked': rate == 16, 'args': ('16',), 'kwargs': {}, 'pos': 3}, '18': {'handler': self.rate, 'caption': _('16 - 18 years'), 'checked': rate == 18, 'args': ('18',), 'kwargs': {}, 'pos': 4}, '99': {'handler': self.rate, 'caption': _('Hidden'), 'checked': rate == 99, 'args': ('99',), 'kwargs': {}, 'pos': 5}}
		if rate not in self.actions_dict:
			rate = '0'
		name = self.actions_dict[rate]['caption']
		ActionContainer.__init__(self, name=name, type_='action', menu=menu, **kw)
		self.radio = True
		self._update_checked(rate)

	def rate(self, age):
		self._update_checked(age)
		self.name = self.actions_dict[age]['caption']
		self.menu._set_options_list(keep_selection=True)
		try:
			if isinstance(self.item, DirItem):
				w = LoadingWindow()
				w.show()
				ml = Markerlist(self.item.universe, 'rate')
				ml.add_item(self.item)
				ml['maturity_rating'] = age
				w.hide()
				ml.clear()
			else:
				if self.item['refid']:
					self.item.vfs_set_metas(_unref_link=True, maturity_rating=age)
				else:
					self.item['maturity_rating'] = age



